<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet 
        version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        exclude-result-prefixes="xsl xsi"
>

    <xsl:output 
        method="xml" 
        indent="yes"
        encoding="ISO-8859-1"
	omit-xml-declaration="yes"
    />
    
    <!--
        doctype-public="-//W3C//DTD HTML 4.01//EN"
        doctype-system="http://www.w3.org/TR/html4/strict.dtd"
    -->
    <xsl:variable name="baseURL">/images/</xsl:variable>
    <xsl:variable name="xmlIconURL">
        <xsl:value-of select="$baseURL"/>
        <xsl:text>xml.png</xsl:text>
    </xsl:variable>
    <xsl:variable name="xmlIconWidth">19</xsl:variable>
    <xsl:variable name="xmlIconHeight">9</xsl:variable>
    
    <xsl:template match="opml">
        <!-- <h2>
	    <xsl:value-of select="head/title"/>
	</h2> -->
        <small><xsl:value-of select="head/dateCreated"/></small>
        <xsl:apply-templates select="body/outline" mode="h3">
            <xsl:sort select="@text"/> 
        </xsl:apply-templates>
    </xsl:template>
    
    <xsl:template match="outline" mode="h3">
        <h3><xsl:value-of select="@text"/></h3>
        <ul>
            <xsl:apply-templates select="outline" mode="li">
                <xsl:sort select="@title"/>
            </xsl:apply-templates>
        </ul>
    </xsl:template>

    <xsl:template match="outline" mode="li">
        <li style="margin-left:1em;">
            <a class="outline">
                <xsl:attribute name="href">
                    <xsl:value-of select="@htmlUrl"/>
                </xsl:attribute>
				<xsl:attribute name="title">
					<xsl:value-of select="@htmlUrl"/>
				</xsl:attribute>
    
                <xsl:value-of select="@title"/>
            </a>
            <xsl:text disable-output-escaping="yes">&amp;nbsp;</xsl:text>
            <a class="outline">
                <xsl:attribute name="href">
                    <xsl:value-of select="@xmlUrl"/>
                </xsl:attribute>
				<xsl:attribute name="title">
					<xsl:value-of select="@xmlUrl"/>
				</xsl:attribute>

                <img border="0">
                    <xsl:attribute name="src">
                        <xsl:value-of select="$xmlIconURL"/>
                    </xsl:attribute>
                    <xsl:attribute name="width">
                        <xsl:value-of select="$xmlIconWidth"/>
                    </xsl:attribute>
                    <xsl:attribute name="height">
                        <xsl:value-of select="$xmlIconHeight"/>
                    </xsl:attribute>
                    <xsl:attribute name="alt">
                        <xsl:text>RSS Feed for </xsl:text>
                        <xsl:value-of select="@title"/>
                    </xsl:attribute>
                </img>
            </a>
        </li>
    </xsl:template>
    
</xsl:stylesheet>
